<?php

class AdviseController extends UController
{
	public function actionList()
	{
		$data = array('success'=>0);
		$params = array(
			'page'    => $this->_post('page',1),
			'limit'   => $this->_post('limit',5),
			'user_id' => $this->userId,
		);
		$remote = HttpLib::post($this->javaApi['user_advices'],$params);
		if($remote->success)
		{
			$data['success'] = 1;
			$data['pageNum'] = $remote->result->pageNum;
			$data['list']  = array();
			if($remote->result->pageList)
			{
				foreach($remote->result->pageList as $v)
				{
					$data['list'][] = array(
						'advise'  => $v->advise,
						'askTime' => date('Y-m-d H:i:s',$v->advise_time/1000),
						'answer'  => $v->response?$v->response:'',
					);
				}
			}
		}
		else
			$data['msg'] = $remote->errorMsg;
		$this->setResult($data);
	}
}